package com.dcbeida.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

public class HomePageAdapter extends PagerAdapter {

    List<View> viewList = new ArrayList<>();

    public HomePageAdapter(List<View> list) {
        this.viewList = list;
    }

    @Override
    public int getCount() {
        return viewList.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        View view = viewList.get(position);
        container.addView(view);
        return view;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        // container.removeViewAt(position);
        View view = (View) object;
        container.removeView(view);
    }

//    @Override
//    public float getPageWidth(int position) {
//        return 305f / 375f;
//    }
}
